package com.ning.farm_income_back.controller;

import com.ning.farm_income_back.domain.Users;
import com.ning.farm_income_back.service.LoginService;
import com.ning.farm_income_back.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    LoginService loginService;

    //登录
    @PostMapping("/login")
    public ResultVo<String> login(@RequestBody Users user){
        String token = loginService.login(user);
        return ResultVo.success("登录成功",token);
    }

}

